﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using KDG.FoldersSize.Properties;

namespace KDG.FoldersSize
{
    public partial class FormProperties : Form
    {
        public FormProperties()
        {
            InitializeComponent();
        }

        private void btClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btOk_Click(object sender, EventArgs e)
        {
            int max;
            if (int.TryParse(tbMaxStoredFolder.Text, out max))
                Settings.Default.iMaxStoredPath = max;
            Settings.Default.bShowIconsFromExplorer = cbIconsFromExplorer.Checked;
            Settings.Default.colIndicatorFrom = btColorFrom.BackColor;
            Settings.Default.colIndicatorTo = btColorTo.BackColor;

            Settings.Default.Save();
            this.Close();
        }

        private void FormProperties_Load(object sender, EventArgs e)
        {
            tbMaxStoredFolder.Text = Settings.Default.iMaxStoredPath.ToString();
            cbIconsFromExplorer.Checked = Settings.Default.bShowIconsFromExplorer;
            btColorFrom.BackColor = Settings.Default.colIndicatorFrom;
            btColorTo.BackColor = Settings.Default.colIndicatorTo;
        }

        private void btColorFrom_Click(object sender, EventArgs e)
        {
            if (colorDialog1.ShowDialog() == DialogResult.OK)
                btColorFrom.BackColor = colorDialog1.Color;
        }

        private void btColorTo_Click(object sender, EventArgs e)
        {
            if (colorDialog1.ShowDialog() == DialogResult.OK)
                btColorTo.BackColor = colorDialog1.Color;
        }
    }
}
